<?php
	include '../models/Model.php';
	$model=new Model();
    $orderId=$_POST['orderId'];
    $cancelFee=$model->getCancelFee();
    if(count($orderId)>0)
    {
    	foreach($orderId as $id)
    
	    {
	    	//echo $id;
	    	$order=$model->getOrderById($id);
	 		//var_dump($order);die;
	 		$userId=$order->getUserId();
	 		$order->setOrderStatus(2);
	    	//$model->setPenaltyUser($userId,5000);
	    	$model->updateOrder($order);
	    }
	    echo "<script type='text/javascript'>\n";
		echo "alert('Canceled successful!You will be punished ".$cancelFee."vnd');\n";
		echo "window.location='../view/user/view_room.php'";
		echo "</script>";
    }
	 else
	 {
	 	echo "<script type='text/javascript'>\n";
		echo "alert('Invalid input ');\n";
		echo "window.location='../view/user/view_room.php'";
		echo "</script>";
	 }   
	header('Location:'.'../view/user/view_room.php');    
?>    